home *** CD-ROM | disk | FTP | other *** search
/ Visual Basic Controls / Visual Basic Controls.iso / vbcontrol / bw5df11s / sample.frm (.txt) < prev    next >
Encoding:
Visual Basic Form  |  1999-06-09  |  11.7 KB  |  381 lines

  1. VERSION 5.00
  2. Object = "{2E0F38D3-1E76-11D3-AC42-00C0DFE9A30F}#4.0#0"; "BW5DF11S.OCX"
  3. Object = "{6B7E6392-850A-101B-AFC0-4210102A8DA7}#1.2#0"; "COMCTL32.OCX"
  4. Begin VB.Form Form1 
  5.    Caption         =   "BW Disk Format OCX - Sample project"
  6.    ClientHeight    =   5145
  7.    ClientLeft      =   165
  8.    ClientTop       =   450
  9.    ClientWidth     =   8025
  10.    LinkTopic       =   "Form1"
  11.    ScaleHeight     =   5145
  12.    ScaleWidth      =   8025
  13.    StartUpPosition =   2  'CenterScreen
  14.    Begin ComctlLib.ProgressBar ProgressBar1 
  15.       Height          =   135
  16.       Left            =   120
  17.       TabIndex        =   31
  18.       Top             =   4920
  19.       Width           =   7815
  20.       _ExtentX        =   13785
  21.       _ExtentY        =   238
  22.       _Version        =   327682
  23.       Appearance      =   1
  24.    End
  25.    Begin DiskFormatOCX.DiskFormat DiskFormat1 
  26.       Left            =   5040
  27.       Top             =   1200
  28.       _ExtentX        =   979
  29.       _ExtentY        =   979
  30.    End
  31.    Begin VB.TextBox Text3 
  32.       Height          =   285
  33.       Left            =   6000
  34.       TabIndex        =   26
  35.       Top             =   2130
  36.       Width           =   1935
  37.    End
  38.    Begin VB.CommandButton Command6 
  39.       Caption         =   "Set label"
  40.       Height          =   375
  41.       Left            =   3240
  42.       TabIndex        =   25
  43.       Top             =   2040
  44.       Width           =   1455
  45.    End
  46.    Begin VB.CommandButton Command5 
  47.       Caption         =   "Get label"
  48.       Height          =   375
  49.       Left            =   3240
  50.       TabIndex        =   24
  51.       Top             =   1560
  52.       Width           =   1455
  53.    End
  54.    Begin VB.ComboBox Combo2 
  55.       Height          =   315
  56.       ItemData        =   "Sample.frx":0000
  57.       Left            =   6000
  58.       List            =   "Sample.frx":001C
  59.       TabIndex        =   23
  60.       Text            =   "1440"
  61.       Top             =   480
  62.       Width           =   1935
  63.    End
  64.    Begin VB.ComboBox Combo1 
  65.       Height          =   315
  66.       ItemData        =   "Sample.frx":0048
  67.       Left            =   6000
  68.       List            =   "Sample.frx":006A
  69.       TabIndex        =   21
  70.       Text            =   "Full"
  71.       Top             =   120
  72.       Width           =   1935
  73.    End
  74.    Begin VB.CommandButton Command4 
  75.       Caption         =   "Disk status"
  76.       Height          =   375
  77.       Left            =   3240
  78.       TabIndex        =   19
  79.       Top             =   1080
  80.       Width           =   1455
  81.    End
  82.    Begin VB.CommandButton Command3 
  83.       Caption         =   "Cancel Format"
  84.       Height          =   375
  85.       Left            =   3240
  86.       TabIndex        =   16
  87.       Top             =   600
  88.       Width           =   1455
  89.    End
  90.    Begin VB.CommandButton Command2 
  91.       Caption         =   "Format Disk"
  92.       Height          =   375
  93.       Left            =   3240
  94.       TabIndex        =   15
  95.       Top             =   120
  96.       Width           =   1455
  97.    End
  98.    Begin VB.TextBox Text1 
  99.       Height          =   285
  100.       Left            =   2160
  101.       TabIndex        =   2
  102.       Text            =   "a:\"
  103.       Top             =   600
  104.       Width           =   615
  105.    End
  106.    Begin VB.CommandButton Command1 
  107.       Caption         =   "Get disk information"
  108.       Height          =   375
  109.       Left            =   240
  110.       TabIndex        =   0
  111.       Top             =   120
  112.       Width           =   2535
  113.    End
  114.    Begin VB.Label Label20 
  115.       Height          =   255
  116.       Left            =   360
  117.       TabIndex        =   30
  118.       Top             =   3360
  119.       Width           =   7695
  120.    End
  121.    Begin VB.Label Label10 
  122.       Height          =   255
  123.       Left            =   1680
  124.       TabIndex        =   29
  125.       Top             =   1080
  126.       Width           =   1815
  127.    End
  128.    Begin VB.Label Label8 
  129.       Caption         =   "  Drive type :"
  130.       Height          =   255
  131.       Left            =   600
  132.       TabIndex        =   28
  133.       Top             =   1080
  134.       Width           =   975
  135.    End
  136.    Begin VB.Label Label1 
  137.       Caption         =   "Label :"
  138.       Height          =   255
  139.       Left            =   5400
  140.       TabIndex        =   27
  141.       Top             =   2160
  142.       Width           =   495
  143.    End
  144.    Begin VB.Label Label22 
  145.       Caption         =   "Disk size : "
  146.       Height          =   255
  147.       Left            =   5160
  148.       TabIndex        =   22
  149.       Top             =   480
  150.       Width           =   735
  151.    End
  152.    Begin VB.Label Label21 
  153.       Caption         =   "Format method :"
  154.       Height          =   255
  155.       Left            =   4800
  156.       TabIndex        =   20
  157.       Top             =   120
  158.       Width           =   1335
  159.    End
  160.    Begin VB.Label Label19 
  161.       Height          =   255
  162.       Left            =   360
  163.       TabIndex        =   18
  164.       Top             =   4080
  165.       Width           =   7695
  166.    End
  167.    Begin VB.Label Label18 
  168.       Height          =   255
  169.       Left            =   360
  170.       TabIndex        =   17
  171.       Top             =   3720
  172.       Width           =   7575
  173.    End
  174.    Begin VB.Label Label17 
  175.       Caption         =   " File system :"
  176.       Height          =   255
  177.       Left            =   600
  178.       TabIndex        =   14
  179.       Top             =   2520
  180.       Width           =   975
  181.    End
  182.    Begin VB.Label Label15 
  183.       Caption         =   "Used space :"
  184.       Height          =   255
  185.       Left            =   600
  186.       TabIndex        =   13
  187.       Top             =   2280
  188.       Width           =   1095
  189.    End
  190.    Begin VB.Label Label14 
  191.       Caption         =   " Free space :"
  192.       Height          =   255
  193.       Left            =   600
  194.       TabIndex        =   12
  195.       Top             =   2040
  196.       Width           =   975
  197.    End
  198.    Begin VB.Label Label13 
  199.       Caption         =   "Total space :"
  200.       Height          =   255
  201.       Left            =   600
  202.       TabIndex        =   1
  203.       Top             =   1800
  204.       Width           =   975
  205.    End
  206.    Begin VB.Label Label12 
  207.       Caption         =   "Volume number :"
  208.       Height          =   255
  209.       Left            =   360
  210.       TabIndex        =   11
  211.       Top             =   1560
  212.       Width           =   1215
  213.    End
  214.    Begin VB.Label Label11 
  215.       Caption         =   "Volume name :"
  216.       Height          =   255
  217.       Left            =   480
  218.       TabIndex        =   10
  219.       Top             =   1320
  220.       Width           =   1095
  221.    End
  222.    Begin VB.Label Label9 
  223.       Height          =   255
  224.       Left            =   1680
  225.       TabIndex        =   9
  226.       Top             =   2520
  227.       Width           =   1095
  228.    End
  229.    Begin VB.Label Label7 
  230.       Height          =   255
  231.       Left            =   1680
  232.       TabIndex        =   8
  233.       Top             =   2280
  234.       Width           =   1575
  235.    End
  236.    Begin VB.Label Label5 
  237.       Height          =   255
  238.       Left            =   1680
  239.       TabIndex        =   7
  240.       Top             =   2040
  241.       Width           =   1575
  242.    End
  243.    Begin VB.Label Label4 
  244.       Height          =   255
  245.       Left            =   1680
  246.       TabIndex        =   6
  247.       Top             =   1800
  248.       Width           =   1455
  249.    End
  250.    Begin VB.Label Label3 
  251.       Height          =   255
  252.       Left            =   1680
  253.       TabIndex        =   5
  254.       Top             =   1560
  255.       Width           =   1455
  256.    End
  257.    Begin VB.Label Label2 
  258.       Height          =   255
  259.       Left            =   1680
  260.       TabIndex        =   4
  261.       Top             =   1320
  262.       Width           =   1575
  263.    End
  264.    Begin VB.Label Label6 
  265.       Caption         =   "Type the drive , ex: a:\"
  266.       Height          =   255
  267.       Left            =   240
  268.       TabIndex        =   3
  269.       Top             =   600
  270.       Width           =   1815
  271.    End
  272.    Begin VB.Menu about 
  273.       Caption         =   "About"
  274.    End
  275. Attribute VB_Name = "Form1"
  276. Attribute VB_GlobalNameSpace = False
  277. Attribute VB_Creatable = False
  278. Attribute VB_PredeclaredId = True
  279. Attribute VB_Exposed = False
  280. Private Sub about_Click()
  281. DiskFormat1.About
  282. End Sub
  283. Private Sub DiskFormat1_BadSectorReport(BadSectorReportDescription As String)
  284. Label20.Caption = "Bad sector report : " & BadSectorReportDescription
  285. End Sub
  286. Private Sub DiskFormat1_Finished(ReturnCode As Long, ReturnCodeDescription As String)
  287. Label18.Caption = "Finished - return information : " & ReturnCode & " :  " & ReturnCodeDescription
  288. Dim TotalSpace As Long
  289. Dim UsedSpace As Long
  290. Dim FreeSpace As Long
  291. Dim FileSystem As String
  292. Dim VolumeName As String
  293. Dim VolumeNumber As Long
  294. Dim Drivetype As String
  295. Dim ret As Boolean
  296. ret = DiskFormat1.GetDriveInfos(Text1.Text, FileSystem, VolumeName, VolumeNumber, Drivetype, TotalSpace, FreeSpace, UsedSpace)
  297. Label2.Caption = VolumeName
  298. Label3.Caption = Hex(VolumeNumber)  ' It will represent the volume number in the same way that you see when using the Dir command
  299. Label4.Caption = TotalSpace
  300. Label5.Caption = FreeSpace
  301. Label7.Caption = UsedSpace
  302. Label9.Caption = FileSystem
  303. Label10.Caption = Drivetype
  304. End Sub
  305. Private Sub DiskFormat1_Progress(ProgressValue As Long)
  306. 'This event will be raised in any update of the progress of the format function
  307. 'And it will represent perfectly the exact point of the format execution
  308. Label20.Caption = ""
  309. On Error Resume Next
  310. ProgressBar1.Value = ProgressValue
  311. End Sub
  312. Private Sub DiskFormat1_Status(OCXStatusLong As Long, OCXStatusString As String)
  313. 'This event will show what the OCX is doing at any point
  314. Label19.Caption = OCXStatusString
  315. End Sub
  316. Private Sub Command1_Click()
  317. Dim TotalSpace As Long
  318. Dim UsedSpace As Long
  319. Dim FreeSpace As Long
  320. Dim FileSystem As String
  321. Dim VolumeName As String
  322. Dim VolumeNumber As Long
  323. Dim Drivetype As String
  324. Dim ret As Boolean
  325. ret = DiskFormat1.GetDriveInfos(Text1.Text, FileSystem, VolumeName, VolumeNumber, Drivetype, TotalSpace, FreeSpace, UsedSpace)
  326. Label2.Caption = VolumeName
  327. Label3.Caption = Hex(VolumeNumber) ' it will represent the volume number in the same way you see when using the Dir command
  328. Label4.Caption = TotalSpace
  329. Label5.Caption = FreeSpace
  330. Label7.Caption = UsedSpace
  331. Label9.Caption = FileSystem
  332. Label10.Caption = Drivetype
  333. End Sub
  334. Private Sub Command2_Click()
  335. Label18.Caption = ""
  336. Dim Disk As String  'The disk that you want to format
  337. Disk = Text1.Text
  338. DiskFormat1.FormatDisk Disk, Combo1.Text, Combo2.Text
  339. End Sub
  340. Private Sub Command3_Click()
  341. 'It will cancel the format function , and it will return the control to the system
  342. DiskFormat1.CancelFormat
  343. End Sub
  344. Private Sub Command4_Click()
  345. Label19.Caption = ""
  346. Form1.Refresh
  347. Dim ric As Long
  348. ric = DiskFormat1.GetDiskStatus(Text1.Text)
  349. Select Case ric
  350. Case 0
  351. Label19.Caption = "The disk isnot in the drive"
  352. Case 1
  353. Label19.Caption = "Disk ready to be used"
  354. Case 2
  355. Label19.Caption = "The disk isnot formated"
  356. Case 3
  357. Label19.Caption = "The disk is write protected"
  358. Case -1
  359. Label19.Caption = "The drive isnot available"
  360. Case Else
  361. Label19.Caption = "Error trying to identify the type of drive"
  362. End Select
  363. End Sub
  364. Private Sub Command5_Click()
  365. Dim TotalSpace As Long
  366. Dim UsedSpace As Long
  367. Dim FreeSpace As Long
  368. Dim FileSystem As String
  369. Dim VolumeName As String
  370. Dim VolumeNumber As Long
  371. Dim Drivetype As String
  372. Dim ret As Boolean
  373. ret = DiskFormat1.GetDriveInfos(Text1.Text, FileSystem, VolumeName, VolumeNumber, Drivetype, TotalSpace, FreeSpace, UsedSpace)
  374. Text3.Text = VolumeName
  375. End Sub
  376. Private Sub Command6_Click()
  377. If Not DiskFormat1.SetVolumeLabel(Text1.Text, Text3.Text) Then
  378. MsgBox "Unable to set the new label in the drive  " & Text1.Text
  379. End If
  380. End Sub
  381.